package com.hdl.service.impl;

import com.hdl.dao.ResumeDao;
import com.hdl.pojo.Resume;
import com.hdl.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;
import java.util.List;
import java.util.Optional;

/**
 * 类名 ResumeServiceImpl
 * 描述 TODO
 *
 * @author hedonglin
 * @version 1.0
 * @date 2020/5/16 12:16
 */
@Service
public class ResumeServiceImpl implements ResumeService {
    @Autowired
    private ResumeDao resumeDao;

    @Override
    public List<Resume> findAll() {
        return resumeDao.findAll();
    }

    @Transactional(rollbackOn = Exception.class)
    @Override
    public Resume save(Resume resume) {
        return resumeDao.save(resume);
    }

    @Override
    public  Optional<Resume> findById(Long id) {
        final Optional<Resume> optional = resumeDao.findById(id);
        return optional;
    }

    @Transactional(rollbackOn = Exception.class)
    @Override
    public void deleteById(Long id) {
        resumeDao.deleteById(id);
    }
}
